package com.jmlee.service.impl;

import com.jmlee.mapper.AShopMapper;
import com.jmlee.pojo.AShop;
import com.jmlee.pojo.Admin;
import com.jmlee.service.ShopService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商家后台管理
 *
 * @author xl W
 * @date 2021/3/13 15:58
 */
@Service
public class ShopServiceImpl implements ShopService {


    @Autowired
    private AShopMapper shopMapper;

    //============================================后台商家===================================================

    /**
     * 添加后台商家
     *
     * @params shop
     * @return
     */
    @Override
    public int addShop(AShop shop) {
        return shopMapper.addShop(shop);
    }

    /**
     * 商家管理 删除商家
     *
     * @author xl W
     * @date 2021/3/6 15:27
     */
    @Override
    public boolean shopDelete(AShop shop) {
        return shopMapper.adminDelete(shop);
    }
    //商家管理启用禁用

    /**
     * 查找总商家数
     *
     * @author xl W
     * @date 2021/3/6 15:27
     */
    @Override
    public int selectShopListCount(AShop shop) {
        return shopMapper.selectShopListCount(shop);
    }

    //商家审核通过
    @Override
    public boolean shuoCan(String aId) {
        return shopMapper.shuoCan(aId);
    }
    //商家审核不通过
    @Override
    public boolean shopNoPass(String aId) {
        return shopMapper.shopNoPass(aId);
    }



    @Override
    public List<AShop> selectShopList(AShop shop, RowBounds rowBounds) {
        return shopMapper.selectShopList(shop, rowBounds);
    }

    //商家管理 禁用
    @Override
    public boolean shopForbidden(AShop shop) {
        return shopMapper.shopForbidden(shop);
    }

    //商家管理 启用
    @Override
    public boolean shopStart(AShop shop) {
        return shopMapper.shopStart(shop);
    }

    @Override
    public AShop queryShopById(Long aid) {
        return shopMapper.queryShopById(aid);
    }

    @Override
    public AShop selectShop(Admin username) {
        return shopMapper.selectShop(username);
    }

    @Override
    public Integer editShopInfo(AShop aShop) {
        return shopMapper.updateShopInfo(aShop);
    }

}
